home *** CD-ROM | disk | FTP | other *** search
/ Champak 140 / (Vol 140) Sep 19 2011.iso / Games / theLifeArk.swf / scripts / __Packages / prop / pz3.as < prev    next >
Encoding:
Text File  |  2011-09-19  |  2.4 KB  |  83 lines

  1. class prop.pz3 extends MovieClip
  2. {
  3.    var disk1;
  4.    var disk2;
  5.    var turnMax;
  6.    var turnCnt;
  7.    var overCnt;
  8.    var frm1;
  9.    var frm2;
  10.    function pz3()
  11.    {
  12.       super();
  13.       this.disk1.stop();
  14.       this.disk2.stop();
  15.       this.turnMax = 1 + Math.ceil(Math.random() * 3);
  16.       trace("turnMax " + this.turnMax);
  17.       this.turnCnt = 0;
  18.    }
  19.    function btnPrs()
  20.    {
  21.       this.overCnt = 0;
  22.       _global.ctn.sndCtrl.playSound("snd_stoneSpin");
  23.       if(this.turnCnt < this.turnMax)
  24.       {
  25.          this.turnCnt = this.turnCnt + 1;
  26.          this.frm1 = "s" + Math.ceil(Math.random() * 6);
  27.          this.frm2 = "s" + Math.ceil(Math.random() * 6);
  28.          this.disk1.startAni(this.frm1);
  29.          this.disk2.startAni(this.frm2);
  30.       }
  31.       else
  32.       {
  33.          this.frm1 = "s6";
  34.          this.frm2 = "s6";
  35.          this.disk1.startAni(this.frm1);
  36.          this.disk2.startAni(this.frm2);
  37.       }
  38.    }
  39.    function aniOver()
  40.    {
  41.       if(_global.scene.pot.runSta != "steamPot" && _global.scene.fireSeed.runSta == "hide")
  42.       {
  43.          this.turnCnt = 0;
  44.          if(this._visible)
  45.          {
  46.             _global.ctn.sndCtrl.playSound("snd_pzWrong");
  47.          }
  48.          this._visible = false;
  49.       }
  50.       else
  51.       {
  52.          this.overCnt = this.overCnt + 1;
  53.          if(this.overCnt >= 2)
  54.          {
  55.             trace("both of the ani over");
  56.             if(this.frm1 == "s6" && this.frm2 == "s6")
  57.             {
  58.                trace("check is ok");
  59.                if(_global.scene.pot.runSta == "steamPot" && _global.scene.fireSeed.runSta == "fire")
  60.                {
  61.                   _global.ctn.sndCtrl.playSound("snd_pzRight");
  62.                   _global.scene.stoneDoorAni.spinAni.spinAniCtt.play();
  63.                   _global.scene.fireSeed.stop();
  64.                   _global.scene.steamBtn.unloadMovie();
  65.                   this._visible = false;
  66.                   if(!_global.scene.pzFireScoreOver)
  67.                   {
  68.                      _global.scene.pzFireScoreOver = true;
  69.                      _global.ctn.game.addScore(214,214,40,60);
  70.                      _global.ctn.game.addScore(124,Math.round(412 * (1 - this.turnCnt / this.turnMax)),40,60);
  71.                   }
  72.                }
  73.                else
  74.                {
  75.                   _global.ctn.sndCtrl.playSound("snd_pzWrong");
  76.                   this._visible = false;
  77.                }
  78.             }
  79.          }
  80.       }
  81.    }
  82. }
  83.